package cn.moukou.dictator.util;

import cn.moukou.dictator.pojo.node.KVNode;
import cn.moukou.dictator.pojo.relation.KVNODE_RELATION;
import cn.moukou.dictator.vo.NodeVO;
import cn.moukou.dictator.vo.RelationVO;

import java.util.ArrayList;
import java.util.List;

public class VOUtil {

    public static List<NodeVO> getNodeVOList(List<KVNode> nodeList) {
        List<NodeVO> voList = new ArrayList<>();
        for(int i = 0; i < nodeList.size(); ++i) {
            voList.add(new NodeVO(nodeList.get(i)));
        }
        return voList;
    }

    public static List<NodeVO> getNodeVOList(Iterable<KVNode> nodeList) {
        List<NodeVO> voList = new ArrayList<>();
        for (KVNode node : nodeList) {
            voList.add(new NodeVO(node));
        }
        return voList;
    }

    public static List<RelationVO> getRelationVOList(List<KVNODE_RELATION> relationList) {
        List<RelationVO> voList = new ArrayList<>();
        for (KVNODE_RELATION relation : relationList) {
            voList.add(new RelationVO(relation));
        }
        return voList;
    }

    public static List<RelationVO> getRelationVOList(Iterable<KVNODE_RELATION> relationList) {
        List<RelationVO> voList = new ArrayList<>();
        for (KVNODE_RELATION relation : relationList) {
            voList.add(new RelationVO(relation));
        }
        return voList;
    }
}
